package com.zhengyao.threadlocal;

/**
 * @Description: 设置IP与线程绑定
 */
public class WebConfig {
    private static ThreadLocal<String> threadLocal = new ThreadLocal<>();
    public static void setThreadLocalIp(String ip){
        System.out.println("当前请求设置IP为：" + ip);
        threadLocal.set(ip);
    }

    public static String getThreadLocalIp() {
        return threadLocal.get();
    }
}
